<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>系统消息</title>
<link rel="stylesheet" href="/public/static/layui/css/layui.css">
<style>
.layim-msgbox{margin: 15px;}
.layim-msgbox li{position: relative; margin-bottom: 10px; padding: 0 130px 10px 60px; padding-bottom: 10px; line-height: 22px; border-bottom: 1px dotted #e2e2e2;}
.layim-msgbox .layim-msgbox-tips{margin: 0; padding: 10px 0; border: none; text-align: center; color: #999;}
.layim-msgbox .layim-msgbox-system{padding: 0 10px 10px 10px;}
.layim-msgbox li p span{padding-left: 5px; color: #999;}
.layim-msgbox li p em{font-style: normal; color: #FF5722;}
.layim-msgbox-system a{color: #FB0206}
</style>
</head>
<body>
 
  <ul  class="layim-msgbox" id="LAY_view">
  </ul>
 
<div id="LAY_page" style="margin: 0 10px;"></div>
<textarea title="消息模版" id="LAY_tpl" style="display:none;">
{{#  layui.each(d.data, function(index, item){ }}
 
    <li class="layim-msgbox-system">
      <p><em>系统：</em>{{ item.content }}<span>{{ layui.data.date(item.timestamp) }}</span></p>
    </li>
 {{#  }); }}
</textarea>
<script type="text/javascript" src="/public/static/js/core/jquery.min.js"></script> 
<script src="/public/static/layui/layui.js"></script> 
<script>
layui.use(['layim', 'flow'], function() {
    var layim = layui.layim,
        layer = layui.layer,
        laytpl = layui.laytpl,
        $ = layui.jquery,
        flow = layui.flow;
    var param = location.search
    let index = layer.msg("请稍候,正在加载数据...");
     
    flow.load({
        elem: '#LAY_page',
        isAuto: false,
        done: function(page, next) {
            var lis = [];
            $.get("/index.php/index.php/index/wxapp.layim/get_more_msg.html?rows=40&uid=9999999&page=" + page, function(res) {
                layer.close(index);
                if (res.code == 0) {
                    var datas = [];
                    res.data.forEach(function(rs) {
                        datas.push({
                             
                            timestamp: rs.full_time * 1000,
                            content: rs.content
                        });
                        lis.push('<li></li>');
                    });
                    var html = laytpl(LAY_tpl.value).render({
                        data: datas
                    });
                    $('#LAY_view').append(html);
                } else {
                    layer.msg('没有任何聊天记录!');
                }
                next(lis.join(''), page < res.paginate.pages);
            });
        }
    });
});
</script>
</body>
</html>
